import Vue from 'vue'
import Vuex from 'vuex'
import state from './state.js'
import mutations from './mutations.js'

Vue.use(Vuex)

export default new Vuex.Store({
  state,
  mutations,
  actions: {
    // ctx是上一个阶段的数据，city是传过来的新数据
    changeCity (ctx, city) {
      ctx.commit('changeCity', city)
    }
  }
})
